<template>
  <a-space>
    <div v-for="item in props.params.buttonList" :key="item.text">
      <el-button
        :type="item.type"
        size="small"
        v-if="
          item.typeName == 'el-button' &&
          (item.show || permissionStore.hasPermisson(item.btnPermission))
        "
        @click="handleClick(item.Callback)"
        link
        
        :disabled="item.disabled"
        >{{ item.text }}
      </el-button>
      <el-tag v-if="item.typeName == 'el-tag'" :type="item.type" @click="item.Callback"
        >{{ item.text }}
      </el-tag>
    </div>

    <!-- <a-tag color="#ff7d00" @click="a1" class="gesture">修改</a-tag>
    <a-tag color="#2961dc" @click="a2" class="gesture">生成标签</a-tag> -->
  </a-space>
</template>

<script setup lang="ts">
  import { onMounted, ref } from 'vue'
  import emitter from '@/hooks/useEventBus'
  import usePermission from '@/store/modules/permission'

  const permissionStore = usePermission()
  const props = withDefaults(
    defineProps<{
      params: any
    }>(),
    {
      params: {},
    }
  )
  onMounted(() => {})
  // let checkboxChange = () => {
  //   props.params.Callback(props.params.data)
  //   // props.params.refreshCell()
  // }
  const handleClick = (fun: any) => {
    const obj = fun(props.params.data)
    emitter.emit(obj.emitString, obj.rowData)
  }
</script>

<style scoped>
  .currency {
    color: blue;
  }
</style>
